<?php 
include('../V_Abrir_Sesion.php');
?>
<!DOCTYPE html>
<html lang="en" class="no-js">
	<head>
		<meta charset="UTF-8" />
		<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> 
		<meta name="viewport" content="width=device-width, initial-scale=1.0"> 
		<title>Usuarios</title>
		<meta name="description" content="Sidebar Transitions: Transition effects for off-canvas views" />
		<meta name="keywords" content="transition, off-canvas, navigation, effect, 3d, css3, smooth" />
		<meta name="author" content="Codrops" />
		<link rel="shortcut icon" href="../favicon.ico">
		<link rel="stylesheet" type="text/css" href="../css/normalize.css" />
		<link rel="stylesheet" type="text/css" href="../css/demo.css" />
		<link rel="stylesheet" type="text/css" href="../css/icons.css" />
		<link rel="stylesheet" type="text/css" href="../css/component.css" />


		 <link href="../css/bootstrap.min.css" rel="stylesheet" media="screen">
    <script type="text/javascript" src="../js/bootstrap-tab.js"></script>
    <script type="text/javascript" src="http://twitter.github.com/bootstrap/assets/js/bootstrap-tab.js"></script>

 <script src="http://code.jquery.com/jquery.js"></script>
        <script src="../js/bootstrap.min.js"></script>
        <script src="../js/prototype.js "type="text/javascript"></script> 
		<script src="../js/modernizr.custom.js"></script>
		<style type="text/css">
		#st-trigger-effects{

			width:250px;
			margin-top:-45px;

		}

		#contenedor{
			width:900px; height:400px;
			 background-color:white; 
			 /*margin-left:400px;*/ 
			 margin-top:125px; 
			 box-shadow: 8px 5px 20px #000;
			-moz-box-shadow: -8px 20px -5px #000;
			-webkit-box-shadow: -8px 20px -5px #000;
			border-radius: 20px;
		}
				#img{
			width: 210px;
			margin-left: 50px;
			margin-top: 50px;
		}
		</style>
	</head>
	<body >
		<div id="st-container" class="st-container">
			
			<nav class="st-menu st-effect-11" id="menu-11">
			<img id="img" src="../../Logotipo/SIPRESTV1_TRANS.png">
				<ul>
					<li><a class="icon icon-data" href="../Formulario">Formulario</a></li>
					<li><a class="icon icon-location" href="../Especialidades">Especialidad</a></li>
					<li><a class="icon icon-study" href="index.php">Usuarios</a></li>
					<li><a class="icon icon-photo" href="../Administradores">Administradores</a></li>
					<li><a class="icon icon-wallet" href="#">Credits</a></li>
				</ul>
			</nav>


			<!-- content push wrapper -->
			<div class="st-pusher" >
				<div class="st-content" ><!-- this is the wrapper for the content -->
					<div class="st-content-inner"><!-- extra div for emulating position:fixed of the menu -->
						<!-- Top Navigation -->
				<div class="codrops-top clearfix" >
							<span class="right"><a style="color:#388A5A;" class="glyphicon glyphicon-off" href="../V_Cerrar_Sesion.php" ><h6>Cerrar Sesión</h6></a></span>
							<br><br>
						</div>
						
						<center>
						<div id="st-trigger-effects">
							<button data-effect="st-effect-11">Ver Menú Principal</button>
							</div>
						</center>	

						<center>
						<div id="contenedor" >
						<!-- DE AQUI -->

						
						<a style="color:#388A5A;" href="ViewUsuarios.php">Nuevo Usuario</a>
						           <center>  
						           	<br>
           <h2>Lista de Usuarios</h2>
           <br><br><br>
             <div class="input-group">
   
              <?php 
              include('../Login/ModelConexion.php');
              $tamano_pag=10;

              $page = 1; //inicializamos la variable $page a 1 por default
              if(array_key_exists('pg', $_GET)){
                    $page = $_GET['pg']; //si el valor pg existe en nuestra url, significa que estamos en una pagina en especifico.
                }

              echo '<table border=1 class="table table-striped">'; 
              echo "<tr>"; 
              echo "<td><b>C&eacute;dula</b></td>"; 
              echo "<td><b>Nombre</b></td>"; 
              echo "<td><b>Primer Apellido</b></td>";
              echo "<td><b>Accion</b></td>";
              echo "</tr>";   
              
              //Objetos
              //$usuario->Us_Buscar();
              $conexion = new Conexion();


               $consulta_conteo = $conexion->Consulta("
                      SELECT COUNT(IDUS) AS personas 
                      FROM tb_us;
              ");

               while ($BuscayCuenta=$conexion->Arreglo($consulta_conteo)) {
                 $conteo=$BuscayCuenta['personas'];
         

               }

               $max_num_pag = ceil($conteo / $tamano_pag); 


               /*echo "$conteo";
               echo "<br>";
               echo "$max_num_pag";*/
               $consulta =  $conexion->Consulta("
				
					SELECT IDUS,NOAD,A1AD
					FROM tb_admin,tb_us
					WHERE tb_admin.IDAD = tb_us.IDUS

                LIMIT ".(($page-1)*10).",10
              ");

              if($conexion->numero_filas($consulta) > 0)
              { 
                while ($Busca_PA= $conexion->Arreglo($consulta))
                {
                  
                	$idus = $Busca_PA['IDUS'];
                  echo "<tr class='success'>"; 
                  echo "<td valign='top'>" .( $Busca_PA['IDUS']) . "</td>"; 
                  echo "<td valign='top'>" .( $Busca_PA['NOAD']) . "</td>";
                  echo "<td valign='top'>" .( $Busca_PA['A1AD']) . "</td>";

                  echo "<td valign='top'><a href=ViewEliminar.php?cedula={$Busca_PA['IDUS']}> <span style='color: #388A5A;' aling=right class='glyphicon glyphicon-remove'> </a></td> ";
          
                  echo "</tr>"; 
                }
              }
       
                  

                 
              ?>

                
              </tr>
              </table>             
            </div>
           
               <ul class="pagination pagination-sm">
                <?php 
                      for($i=0; $i<$max_num_pag;$i++){
                        ?>
                        <li>
                          <?php
                          echo '<a href="View_PA_DP_Buscar.php?pg='.($i+1).'">'.($i+1).'</a>  ';
                          ?>
                        </li>
                        <?php
                       
                    }
                ?>
              </ul> 
              </center>

						      
						<!--  HASTA AQUI-->

			             </div>
           				</center>

				        
            		</div>
          		</div> 
			</div>
						
						</center>
					</div><!-- /st-content-inner -->
				</div><!-- /st-content -->
			</div><!-- /st-pusher -->
		</div><!-- /st-container -->
		<script src="../js/classie.js"></script>
		<script src="../js/sidebarEffects.js"></script>
	</body>
</html>